const combineReducers = (reducers)=>{
    //reducres是一个对象，以键值对存储了：模块名 & 每个模块的reducer
    let reducresKeys = Reflect.ownKeys(reducers);//reducersKeys:['vote','personal']
    /* 
    返回一个合并的reducer
        + 每一次dispatch派发，都是把这个reducer执行
        + state就是redux容器中的公共状态
        + action就是派发时间传递进来的行为对象
    */
    return (state = {},action)=>{
        //把reducers中的每一个小的reducer(每个模块的reducer)执行：把对应模块的状态/action行为对象传递进来；返回的值替换当前模块下的状态！
        let nextState = {};
        reducresKeys.forEach(key=>{
            //key:'vote'/'personal'模块名
            //reducer:每个模块的reducer
            let reducer = reducers[key];
            nextState[key] = reducer(state[key],action);
        })
        return nextState; 
    }
}
export default  combineReducers